package com.xmtlxx.wms.mapper;

import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.common.core.mapper.BaseMapperPlus;
import com.xmtlxx.wms.domain.Store;
import com.xmtlxx.wms.domain.bo.StoreBo;
import com.xmtlxx.wms.domain.vo.StoreVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 仓库Mapper接口
 *
 * @author xmtlxx
 * @date 2022-08-15
 */
public interface StoreMapper extends BaseMapperPlus<StoreMapper, Store, StoreVo> {
    /**
     * 根据条件分页查询仓库
     *
     * @param store 仓库
     * @return Page Store
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "s.create_by"),
        @DataColumn(key = "deptName", value = "s.dept_id"),
        @DataColumn(key = "userName", value = "s.create_by")
    })
    Page<StoreVo> selectPageStoreList(@Param("page") Page<Store> page,@Param("store") StoreBo store);

    /**
     * 查询仓库列表
     *
     * @param store 仓库
     * @return 仓库集合
     */
//    @DataPermission({
//        @DataColumn(key = "tenantName", value = "s.create_by"),
//        @DataColumn(key = "deptName", value = "s.dept_id"),
//        @DataColumn(key = "userName", value = "s.create_by")
//    })
    List<StoreVo> selectStoreList(@Param("store") StoreBo store);

    List<StoreVo> selectStoreListAll(@Param("store") StoreBo store);

    @DataPermission({
        @DataColumn(key = "tenantName", value = "s.create_by"),
//        @DataColumn(key = "deptName", value = "s.dept_id"),
//        @DataColumn(key = "userName", value = "s.create_by")
    })
    List<StoreVo> treeStoreList(@Param("store") StoreBo store);

    StoreVo selectStoreVoByID(String id);

    StoreVo selectStoreVoByDeptID(Long deptId);
    /**
     * 修改子元素关系
     *
     * @param stores 子元素
     * @return 结果
     */
    int updateStoreChildren(@Param("stores") List<Store> stores);

}
